package com.basic.bio.chat.groupchatdemo;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.Socket;

/**
 * @Description:服务器端
 * @Author:Zc9741
 * @QQ:516906531
 */
public class ClientReceiveRunnable implements Runnable{

    private Socket socket;

    public ClientReceiveRunnable(Socket socket) {
        this.socket = socket;
    }

    @Override
    public void run() {
        System.out.println("客户端开始收消息咯。。。");
        try {
            BufferedReader br=new BufferedReader(new InputStreamReader(socket.getInputStream()));
            String line=null;
            while ((line=br.readLine())!=null){
                System.out.println(line);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

